#pragma once
template<class Iterator, class Ref, class Ptr>
class Reverse_Iterator
{
	typedef Reverse_Iterator<Iterator, Ref, Ptr> self;
public:
	Reverse_Iterator(Iterator it)
		:_it(it)
	{}
	self& operator++()
	{
		--_it;
		return *this;
	}
	self& operator++(int)
	{
		Iterator rit = *this;
		--_it;
		return rit;
	}
	self& operator--()
	{
		++_it;
		return *this;
	}
	self& operator--(int)
	{
		Iterator rit = *this;
		--_it;
		return rit;
	}
	Ref operator*()
	{
		Iterator tmp = _it;
		return *(--tmp);
	}
	Ptr operator->()
	{
		return &(operator*());
	}
	bool operator!=(const self& s)
	{
		return _it != s._it;
	}
private:
	Iterator _it;
};